/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.fieo.sgee.model;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author rafael
 */
@Entity
@Table(name = "tipos_pontos")
@NamedQueries({
    @NamedQuery(name = "TypeOfPoint.findAll", query = "SELECT t FROM TypeOfPoint t"),
    @NamedQuery(name = "TypeOfPoint.findById", query = "SELECT t FROM TypeOfPoint t WHERE t.id = :id"),
    @NamedQuery(name = "TypeOfPoint.findByDescricao", query = "SELECT t FROM TypeOfPoint t WHERE t.description = :description"),
    @NamedQuery(name = "TypeOfPoint.findByDataCriacao", query = "SELECT t FROM TypeOfPoint t WHERE t.created_at = :created_at"),
    @NamedQuery(name = "TypeOfPoint.findByDataModificacao", query = "SELECT t FROM TypeOfPoint t WHERE t.updated_at = :updated_at")})
public class TypeOfPoint implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @JoinColumn(name = "imagem_id", referencedColumnName = "id")
    @ManyToOne
    Image image;
    @Basic(optional = false)
    @Column(name = "descricao")
    private String description;
    @Basic(optional = false)
    @Column(name = "data_criacao")
    @Temporal(TemporalType.TIMESTAMP)
    private Date created_at;
    @Basic(optional = false)
    @Column(name = "data_modificacao")
    @Temporal(TemporalType.TIMESTAMP)
    private Date updated_at;

    public TypeOfPoint(Image image, String description) {
        this.image = image;
        this.description = description;
        this.setDateCreation();
    }

    public TypeOfPoint() {
        this.setDateCreation();
    }

    public Date getCreated_at() {
        return created_at;
    }

    public String getDescription() {
        return description;
    }

    public Integer getId() {
        return id;
    }

    public Image getImage() {
        return image;
    }

    public Date getUpdated_at() {
        return updated_at;
    }

    public void setUpdated_at(Date updated_at) {
        this.updated_at = updated_at;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public void setImage(Image image) {
        this.image = image;
    }

    private void setDateCreation() {
        this.created_at = new Date();
        this.updated_at = new Date();
    }
    
}
